title: error private within this context c++
body: <p>I think I have been working on this code too long. Anyway here is whats happening.</p>
  
  <p>header file (scope of the project forbids changing public)</p>
  
  <pre><code>#ifndef FRACTION_
  #define FRACTION_
  
  using namespace std;
  
  #include &lt;iostream&gt;
  
  class Fraction
  {
    private:
  
      int num,denom;
  
  
    public:
  
      // Construct fraction from numerator and denominator
      //
      Fraction( int = 0, int = 1 );
  
      // Construct fraction by copying existing fraction
      //
      Fraction( const Fraction&amp; );
  
      // Assign into fraction by copying existing fraction
      //
      Fraction&amp; operator=( const Fraction&amp; );
  
      // Return true if fraction is valid (non-zero denominator)
      //
      bool IsValid() const;
  
      // Return value of numerator
      //
      int Numerator() const;
  
      // Return value of denominator
      //
      int Denominator() const;
  
      // Input/Output operations
      //
      friend istream&amp; operator&gt;&gt;( istream&amp;, Fraction&amp; );
      friend ostream&amp; operator&lt;&lt;( ostream&amp;, const Fraction&amp; );
  };
  
  // Comparative operations
  //
  bool operator==( const Fraction&amp;, const Fraction&amp; );
  bool operator!=( const Fraction&amp;, const Fraction&amp; );
  bool operator&lt; ( const Fraction&amp;, const Fraction&amp; );
  bool operator&lt;=( const Fraction&amp;, const Fraction&amp; );
  bool operator&gt; ( const Fraction&amp;, const Fraction&amp; );
  bool operator&gt;=( const Fraction&amp;, const Fraction&amp; );
  
  // Arithmetic operations
  //
  Fraction operator+( const Fraction&amp;, const Fraction&amp; );
  Fraction operator-( const Fraction&amp;, const Fraction&amp; );
  Fraction operator*( const Fraction&amp;, const Fraction&amp; );
  Fraction operator/( const Fraction&amp;, const Fraction&amp; );
  
  #endif
  </code></pre>
  
  <p>I am trying to overload the + operator, here is my code for that:</p>
  
  <pre><code>Fraction operator+(const Fraction &amp;f1, const Fraction &amp;f2)
  {
      return(((f1.num*f2.denom)+(f1.denom*f2.num)),(f1.denom*f2.denom));
  }
  </code></pre>
  
  <p>I get an error about referencing num and denom as private variable, I am just having a hard time figuring out how to correct that problem. </p>