hilltop:
Why is this code not incorporated into the Ethernet library? It's very short but quite helpful!
See: Enhancement: add operator==, localPort, remoteIP and remotePort to EthernetClient by ntruchsess · Pull Request #1700 · arduino/Arduino · GitHub
As for why was this function not accepted in the pull request, I've read the associated discussion but still don't understand. I get that compatibility with the Client API is essential but why can't additional functions be added? If you want an easy way to add the remoteIP() function to the stock Ethernet library then you might find this library useful: GitHub - Chris--A/EthernetClientEx: An extension to the Arduino default EthernetClient library.
Note that remoteIP() in the pull request and the EthernetClientEx library as well as EthernetUDP all use an IPAddress return type instead of the "pass by reference" method.