title: C++: Declare a global class and access it from other classes?
body: <p>I have a class which should be declared globally from main() and accessed from other declared classes in the program, how do I do that?</p>
  
  <pre><code>class A{ 
      int i; 
      int value(){ return i;}
  };
  
  class B{ 
     global A a; //or extern?? 
     int calc(){
         return a.value()+10;
     }
  }
  
  main(){
     global A a;
     B b;
     cout&lt;&lt;b.calc();
  }
  </code></pre>