title: class has no member "operator<<"
body: <p>I have read through <a href="https://stackoverflow.com/questions/236801/should-operator-be-implemented-as-a-friend-or-as-a-member-function">Should operator&lt;&lt; be implemented as a friend or as a member function?</a> and <a href="https://stackoverflow.com/questions/1712394/overloading-insertion-operator-in-c">Overloading Insertion Operator in C++</a>, looks like the similar problem, but didn't fix my own problem.</p>
  
  <p>My header file:</p>
  
  <pre><code>using namespace std;
  
  class Animal {
  private: 
      friend ostream &amp; operator&lt;&lt; (ostream &amp; o, Dog &amp; d);
      int number;
  public:
      Animal(int i);
      int getnumber();
  
  };
  
  ostream &amp; operator&lt;&lt; (ostream &amp; o, Dog &amp; d);
  </code></pre>
  
  <p>My cpp:</p>
  
  <pre><code>using namespace std;
  
  int Animal::getnumber(){
      return number;
  }
  
  ostream &amp; Animal::operator&lt;&lt; (ostream &amp; o, Dog &amp; d){
      //...
  }
  
  Animal::Animal(int i) : number(i){}
  </code></pre>
  
  <p>Implementation is simple, but I am getting the error: in cpp - <strong>Error: class "Animal" class has no member "operator&lt;&lt;".</strong> I don't really get it because I already declared insertion operator as a friend in Animal, why am I still getting this error? (put the ostream in public doesn't help)</p>