A little more detail.
On windows, some initialisation code needs to be called to start Winsock.
In SFML, this is done in the SocketInitializer struct. It's created as a variable in SocketImpl.cpp as the file scope variable globalInitializer, it's constructor does the Winsock startup.
The problem is C++ has no defined order that static/file-scope variables are created.
https://en.cppreference.com/w/cpp/language/siof (Static Initialisation Order Fiasco)
So there's two file scope variables being made: globalInitializer (that sets up Winsock) and c (your class that needs Winsock), but there's no way to know which will be constructed first. If c is created before globalInitializer, it will fail.
In your second style, c is constructed in main. The main function is started after all static/file-scope variables have been built, so globalInitializer has definitely gotten to do its work first.
(To be accurate, the order is defined when they are all in the same cpp file. But when they are in different cpp files as is the case here, order is indeterminate)