title: friend function of base class and derived class
body: <p>I have a base class Fraction and a derived class iFraction. Fraction represents the improper fractions and iFraction represents the mixed fractions.</p>
  
  <pre><code>class Fraction {...};
  class iFraction : public Fraction {...};
  </code></pre>
  
  <p>Now, I want to declare a friend function of these two class, namely convertF. The function convertF can convert the improper fractions(Fraction) to mixed fractions(iFraction). 
  How cold I do this?
  Actually, I'd like to declare the function like this:</p>
  
  <pre><code>friend iFraction convertF (Fraction &amp;Fra);
  </code></pre>
  
  <p>However, it can't be declared within the base calss Fraction. why?</p>