To find the IP address that SSH has connected to (note a machine can have more than address!) look at the SSH_CONNECTION environment variable, e.g.:

echo $SSH_CONNECTION  | cut -f3 -d' '

inside the ssh session of interest.

Looking at the routing table (e.g. by ip route get 8.8.8.8) at the server may not be definitive.

See also: https://askubuntu.com/questions/608956/get-current-ssh-sessions-originating-ip-without-being-superuser