ssh -J user@machineB user@machineA
From man ssh:
-J [user@]host[:port] Connect to the target host by first making a ssh connection to the jump host and then establishing a TCP forwarding to the ultimate destination from there. Multiple jump hops may be specified separated by comma characters. This is a shortcut to specify a ProxyJump configuration directive.
It was introduced in OpenSSH version 7.3 (released in August 2016). It is available in Ubuntu 16.10 and later.
Source: https://askubuntu.com/a/996657
SSH back into a non public IP already connected: https://unix.stackexchange.com/a/132330