title: Overloaded 'operator++' must be a unary or binary operator (has 3 parameters)
body: <p>I have a header file and a .cpp file. I am trying to implement a prefix and postfix operator overload but I keep getting this error when setting up the overload.     </p>
  
  <p>fraction.h</p>
  
  <pre><code>#ifndef FRACTION_H
  #define FRACTION_H
  
  #include &lt;iostream&gt;
  
  using namespace std;
  
  class Fraction 
  {
     public:
        Fraction();
        Fraction(int, int);
        int getTop() {return m_top;}
        int getBottom() {return m_bottom;}
        void set(int t, int b) {m_top=t; m_bottom=b; reduce();
        }
  
     protected:
     private:
        void reduce();
        int gcf(int, int);
  
        int m_top;
        int m_bottom;
  };
  
  Fraction&amp; operator ++ (Fraction);
  Fraction operator++(Fraction, int);
  
  #endif
  </code></pre>
  
  <p>Main.cpp</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  using namespace std;
  #include "fraction.h"
  
  int main {
     cout &lt;&lt; "The fraction is" &lt;&lt; f;
     cout &lt;&lt; "The output of ++f is " &lt;&lt; (++f) &lt;&lt; endl;
     cout &lt;&lt; "The fraction is" &lt;&lt; f;
     cout &lt;&lt; "The output of f++ is " &lt;&lt; (f++) &lt;&lt; endl;
     cout &lt;&lt; "The fraction is" &lt;&lt; f;
  
     return 0;
  }
  
  Fraction&amp; Fraction::operator ++ (Fraction){
     // Increment prefix
     m_top += m_bottom;
     return *this;
  }
  
  Fraction Fraction::operator ++ (Fraction, int){
     //Increment postfix
  }
  </code></pre>
  
  <p>These are the two errors I get:</p>
  
  <pre><code> prefix error: "Parameter of overloaded post-increment operator must have type 'int' (not 'Fraction')"
  
  postfix error: "Overloaded 'Operator++' must be a unary or binary operator (has 3 parameters)"
  </code></pre>
  
  <p>Is the prefix error actually an error with my ide? I know it must be 'int' for post-increment, but I am trying to do a pre-increment. I use xcode. </p>