Ok, I think what I'm trying to do with the Client *client = (ClientSocket *)server->nextPendingConnection() line is to downcast from base to derived class. (Since ClientSocket is derived from QTcpSocket and nextPendingConnection returns a pointer to a QTcpSocket).
I've read that this is a bad thing, even when using pointers, as I'm abusing the whole inheritance system

I thought about using static_cast, but I guess it would be better to change it altogether by using a separate class ClientSocket that doesn't inherit from QTcpSocket but contains a QTcpSocket pointer? Also, would using auto pointers help in this regard?