title: How to solve operator>> overloading error (no match for 'operator>>')
body: <p>I've looked through other topics about this and tried to see if I can find my error, but I wasn't able to find out how to solve my error.</p>
  
  <p>My error:</p>
  
  <pre><code>no match for ‘operator&gt;&gt;’ (operand types are ‘std::istream {aka std::basic_istream&lt;char&gt;}’ and ‘Polynomial()’)
  cin &gt;&gt; p3;
  </code></pre>
  
  <p>main:</p>
  
  <pre><code>// includes, namespace, etc...
  
  int main()
  {
      Polynomial p3();
  
      // Prompts user and assigns degrees and coefficients
      cout &lt;&lt; "Enter the degree followed by the coefficients: ";
      cin &gt;&gt; p3;
  
      // other coding
   }
  </code></pre>
  
  <p>Header file definition for operator >>:</p>
  
  <pre><code>class Polynomial 
  {
        private:
            double *coefs;
            int degree;
        public:
            // constructors, setters/getters, functions
            friend std::istream &amp;operator &gt;&gt;(std::istream &amp;in, Polynomial &amp;poly);
  };
  </code></pre>
  
  <p>Implementation file:</p>
  
  <pre><code>Polynomial::Polynomial() // default constructor
  {
      degree = 0;
      coefs = new double[1];
      coefs[0] = 0.0;
  }
  
  std::istream &amp;operator &gt;&gt;(std::istream &amp;in, Polynomial &amp;poly) ////!!!!!!
  {
      in &gt;&gt; poly.degree;
  
      delete[] poly.coefs; // deallocate memory
      poly.coefs = new double[poly.degree + 1]; // create new coefficient array
  
      for(int i = 0; i &lt;= poly.degree; i++) // assigns values into array
      {
          in &gt;&gt; poly.coefs[i];
      }
  
      return in;
  }
  </code></pre>