title: Undefined class error in c++
body: <p>If i have two class in different headers:</p>
  
  <p>first header:</p>
  
  <pre><code>include "second_header.h"
  class A
  {
     int x;
  
  };
  </code></pre>
  
  <p>and the second:</p>
  
  <pre><code>include "first_header.h"
  class A;
  class B
  {
     A a;
  };
  </code></pre>
  
  <p>why does the compiler gives me an error of undefined class,can i have an explanation ? </p>