title: Can't use class members from class in header file (Visual Studio)
body: <p>I have</p>
  <pre><code>//a.h file
  
  class A {
  public:
     int var_A;
  };
  </code></pre>
  <p>and</p>
  <pre><code>//b.h file
  #include &quot;a.h&quot;
  
  class B {
  public:
     A* A_pntr;
     void fooB() {
        A* other_A_pntr = A_pntr;      //this works
        std::cout &lt;&lt; A_pntr-&gt;var_A;    //this fails
     }
  };
  </code></pre>
  <p>I can only use class <code>A</code> in a pointer,
  but can't use specific variables or functions.</p>
  <p>I did the same thing in other files of my project and it works. It only fails in one file and there is nothing different in the code.</p>
  <p>Precompiled headers are also turned off.</p>
  <p>It's as if <code>A</code> was only forward declared.</p>
  <p>Error message: <code>C2027: Usage of undeclared type &quot;A&quot;</code></p>
  <p>Any help is appreciated!</p>
  <p>Note: To give more clarification about my project:</p>
  <p>I have a base class defined in one header file and derived classes in their own header files. Most of them use the other derived classes, meaning I include the proper header file and have a reference to that class inside the other class (so I can use the members). It works everywhere except here and all derived classes are practically the same. The only solution I found online was &quot;precompiled headers&quot;. But I have that turned off already.</p>