The following configuration example assumes that user1 is the user account used on client, user2 on relay and user3 on server. First, assuming we will use port 2222, the server needs to establish the reverse tunnel with:

ssh -R 2222:localhost:22 -N user2@relay

Which can also be automated with a startup script, systemd service, autossh or sidedoorAUR.

At the client side, the connection is established with:

ssh -t user2@relay ssh user3@localhost -p 2222

Note: ssh _user3_@_relay_ -p 2222 would require you to open this port in the firewall of your relay server, as well as to allow connections to this port from other addresses.