Transferring files between 2 remote linux virtual machines

Me and my friend are trying to transfer files remotely using scp. We have both installed ssh server and turned it online but when trying to use the command nothing happens.
I am trying to transfer using his public ip.
It says it is listening on port 22, but I don’t know what is the problem.