You or a friend needs to host a server via port forwarding; if you need help port forwarding you can look that up on YouTube because it is different for each kind of router. You will then need to connect to your friends public ipv4 and you can check if the port is open using a port checker while the server is open. If you are having issues connecting after port forwarding you might need to make an exception in your firewall or you can disable if while you play as an easier solution.
Note: if you have an apple router you will not be able to port forward as easily as other routers.