So, I generate a ssh key, and I have a nice ./ssh/id_rsa and ./ssh/id_rsa.pub and now I am suppose to copy it on my friend's computer ?
Yes, specifically, you're supposed to copy your
~/.ssh/id_rsa.pub file (the public key) to the remote system's
(Although, you really ought to have your own user account on the target machine, instead of sharing your friend's "userB" account.)
[ssh-copy-id] is not working (how could it, since we are not bounded yet ?)
Normally, it would work by entering a password to log in to the remote system. (SSH uses the same "system" accounts and passwords as local logins do.)
The thing about SSH here is that it allows the client to choose from several login methods – it's not actually only keypair-based. (Sort of like how a website can allow you to log in with password, log in with Google, log in with USB token, etc.)
Of course, if the remote system already has password-based logins disabled (which has become somewhat of a necessity nowadays), then indeed ssh-copy-id cannot work out of nothing, and you will need to copy your public key to the server's "authorized_keys" file in some other way.
Fortunately, the public key is just a long line of text, so you can paste it via email or Discord or whatever else. (And while RSA keys are long,
ssh-keygen -t ed25519 will produce a much shorter id_ed25519.pub which can even be written down on paper in a pinch.)
(Though even in those situations, ssh-copy-id can still remain technically useful if you already have one keypair working, and want to use it to enroll another. A third alternative would be Kerberos-based logins, mostly found in corporate/hobbyist environments.)
And then on my computer
ssh userB@yyy.yyy.y.yy will work directly ? (which is highly unrealistic, I think...)
Specifically, the SSH part would work, yes.
However, note that SSH doesn't magically go through NATs, and does not automatically set up "port forwarding" for you, so if that's necessary to access your friend's home computer then it'll need to be done separately. (SSH uses TCP port 22.) Similarly, if there's a firewall, it'll need a rule to allow SSH.
So that needs to be dealt with before
ssh y.y.y.y will work.
(Most SSH tutorials don't cover home NAT because it's a very generic thing and not strictly part of SSH setup. It's just kinda assumed that if someone wants to allow connections to home network via IPv4, then they already know what port-forwarding is and how it needs to be configured – there is no difference between doing it for SSH or Minecraft or BitTorrent or whatever.
Also, many SSH tutorials are aimed more at developers and generally people who want to connect to a VPS which has its own public IPv4 address. That's slightly different from you trying to connect to a friend's PC.)