title: Error 1 error C2679: binary '<<' : no operator found which takes a right-hand operand of type 'rational' (or there is no acceptable conversion)
body: <p>greeting all 
  i am working on school project and i have a problem with my cod , what i am trying to do is returning two values.
  any help appreciated :) </p>
  
  <pre><code> #include &lt;iostream&gt;
   #include &lt;string&gt;
   using namespace std;
  
   // class for rational number 
  class rational
    {
  public:
  // input &amp; output the fraction 
  void output(ostream&amp; out);
  void set(int num, int den);
  int get_numerator();
  int get_denominator();
  // the operations
  rational add(rational number);
  rational sub(rational number);
  rational mul(rational number);
  rational div(rational number);
  rational comp(rational number );
  
    private:
  int numerator;
  int denominator;
    };
  
    rational rational1, rational2; // global veriables to use at comparing operations 
  
  rational rational::add(rational number) // addition operation 
   {
  rational sum;
  sum.numerator = numerator*number.denominator + denominator*number.numerator;
  sum.denominator = denominator*number.denominator;
  return sum ;
     }
   rational rational::sub(rational number) // subtract operation 
    {
  rational sum2;
  sum2.numerator =numerator*number.denominator - denominator*number.numerator;
  sum2.denominator = denominator*number.denominator;
  return sum2 ;
  }
  rational rational ::div(rational number) // divede operation 
  {
  rational sum3 ;
  sum3.numerator =numerator*number.denominator ;
  sum3.denominator = denominator*number.numerator;
  return sum3 ;
  
  }
   rational rational::mul(rational number) // multiply operation 
   {
  rational sum4;
  sum4.numerator =numerator*number.numerator;
  sum4.denominator = denominator*number.denominator;
  return sum4 ;
  }
   rational rational::comp (rational number ) // compare operation 
   {
  rational compare1 , compare2 ;
  compare1.denominator = numerator*number.denominator ;
  compare2.numerator = denominator*number.numerator;
  if (compare1.denominator &gt; compare2.numerator)
  { cout &lt;&lt; endl ;
      cout &lt;&lt; "the biggest fraction is  ";
      return rational1;
  
  } else if (compare1.denominator &lt; compare2.numerator ) 
  {
      cout &lt;&lt; endl ;
      cout &lt;&lt; "the biggest fraction is  ";
      return rational2 ;
  } else { 
      cout &lt;&lt; " both fractions are equal ..." &lt;&lt; rational2 &lt;&lt; " = "; // here                                                                                                              
           is the error 
      return rational1  ;
  
  }
  
     }
         void rational::set( int num, int den)
     {
  numerator = num;
  denominator = den;
  }
  
     void rational::output(ostream&amp; out = cout)
      {
  out &lt;&lt; numerator &lt;&lt; "/" &lt;&lt; denominator;
       }
  
  
      int main ()
     {
  rational result ;
  char salsh ;
  
  cout &lt;&lt; "please enter the numerator and denominator for the 1st fraction : ";
  int num, den;
  cin &gt;&gt; num &gt;&gt; salsh &gt;&gt; den;
  if (den ==0)
  {
      cout &lt;&lt; "the denominator can't be zero " &lt;&lt; endl ;
      system("pause");
      return 0;
  }
  
  else 
  {
      rational1.set(num, den);
  
      cout &lt;&lt; "please enter the numerator and denominator for the 2nd fraction :           
                      " ;
      cin &gt;&gt; num &gt;&gt;salsh &gt;&gt; den;
      if (den ==0)
      {
          cout &lt;&lt; "the denominator can't be zero " &lt;&lt; endl ;
          system("pause");
          return 0;
  
      }
      else {
          rational2.set(num, den);
          result = rational1.add(rational2);
          cout &lt;&lt; "The result of adding them is: ";
          result.output(cout);
          cout &lt;&lt; endl ;
  
          result = rational1.sub(rational2);
          cout &lt;&lt; "The result of subtracting them is: ";
          result.output(cout);
          cout &lt;&lt; endl ;
  
          result = rational1.div(rational2);
          cout &lt;&lt; "The result of diveding them is: ";
          result.output(cout);
          cout &lt;&lt; endl ;
  
  
          result = rational1.mul(rational2);
          cout &lt;&lt; "The result multiplying them is: ";
          result.output(cout);
          cout &lt;&lt; endl ; 
  
          result = rational1.comp(rational2) ;
          result.output(cout);
          cout &lt;&lt; endl;
      }
  
  }
  
  system ("pause");
  return 0;
       }
  </code></pre>
  
  <p>Error   1   error C2679: binary '&lt;&lt;' : no operator found which takes a right-hand operand of type 'rational' (or there is no acceptable conversion) c:\users\mike\documents\visual studio 2008\projects\mik\mik\michael shokery.cpp 73</p>
  
  <p>here is the code </p>
  
  <pre><code>   inline ostream&amp; operator&lt;&lt;(ostream&amp; stream,  rational&amp; rational)
  {
   rational.output(stream);
   return stream;
  } 
  </code></pre>