title: no match for operator >> in std::cin
body: <p>I have a class employee</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  #include &lt;fstream&gt;
  using namespace std;
  
  class employee
  {
      public:
  
              double operator + (employee);
              istream&amp; operator&gt;&gt; (istream&amp;);
  
              employee(int);
              double getSalary();
  
      private:
  
             double salary;
  
  };
  
  int main()
  {  
    employee A(400);
    employee B(800);
  
    employee C(220);
  
    cin&gt;&gt;C;
  
  }
  
  employee::employee(int salary)
  {
      this-&gt;salary = salary;
  }
  
  
  double employee::operator + (employee e)
  {
      double total;
  
      total = e.salary + this-&gt;salary;
  
      return total;    
  }
  
  
  double employee::getSalary()
  {
      return this-&gt;salary;
  }
  
  istream&amp; employee::operator&gt;&gt; (istream&amp; in)
  {
      in&gt;&gt;this-&gt;salary;
  
      return in;
  
  }
  </code></pre>
  
  <p>I am trying to overload the input operator >> to read in the employee object but i am getting the following error</p>
  
  <blockquote>
    <p>no match for operator >> in std::cin</p>
  </blockquote>
  
  <p>What am i doing wrong ???</p>
  
  <p><strong>edit: I know how to do it through a friend function , i am now trying to learn how to do it through a member function</strong> </p>