Singleton doubt: how am I able to access a private static object in global space? Code is given below. This runs perfectly fine.
#include <iostream>
using namespace std;
class Singleton {
    static Singleton s;
    static void func()
    {
        cout<<"i am static function "<<endl;
    }
    int i;
    Singleton(int x) : i(x) {
    cout<<"inside Constructor"<<endl;
    }
    void operator=(Singleton&);
    Singleton(const Singleton&);
    public:
    static Singleton& getHandle() {
        return s;
    }
    int getValue() { return i; }
    void setValue(int x) { i = x; }
};
Singleton Singleton::s(47);
int main() {
    Singleton& s = Singleton::getHandle();
    cout << s.getValue() << endl;
    Singleton& s2 = Singleton::getHandle();
    s2.setValue(9);
    cout << s.getValue() << endl;
}
 
     
     
    