A server behind a firewall was unaccesible from my home, but another server which is on the same local network had public SSH access from my home. So we can create an SSH tunnel via this public server to the server behind a firewall.
For example the public ssh server is 188.8.131.52 and the server on the private network that we want to access is 192.168.1.5. Then we can create an SSH tunnel from my laptop at home in the following way:
ssh email@example.com -L 2020:192.168.1.5:22
The above command creates an SSH tunnel, where the local port 2020 on my laptop will be forwarded to port 22 of the private server behind the firewall.
After the tunnel is created you can use the following command to directly SSH from your home laptop to the private server with ip 192.168.1.5:
ssh ubuntu@localhost -p 2020