They're initialized before the program starts (i.e. before main
is entered).
When there are two or more definitions (of static data) in a single CPP file, then they're initialized in the sequence in which they're defined in the file (the one defined earlier/higher in the file is initialized before the next one is).
When there are two or more definitions (of static data) in more than one CPP file, the sequence in which the CPP files are processed is undefined/implementation-specific. This is a problem if the constructor of a global variable (called before the program is started) references another global variable defined in a different CPP file, which might not have been constructed yet. However, item 47 of Meyers' Effective C++ (which is titled Ensure that global objects are initialized before they're used) does describes a work-around ...
Define a static variable in a header file (it's static so you can have multiple instances of it without the linker complaining)
Have the constructor of that variable invoke whatever you need it to (in particular, construct the global singletons declared in the headers)
... which it says is a technique which may be used in some system header files e.g. to ensure that the cin
global variable is initialized before even your static variables' constructors use it.