title: When should you use friend classes?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/17434/when-should-you-use-friend-in-c">When should you use &#39;friend&#39; in C++?</a>  </p>
  </blockquote>
  
  
  
  <p>I have come to a stumbling block because of lack of documentation on friend classes. Most books just explain it briefly, e.g an excerpt from <em>C++: the Complete Reference</em>:</p>
  
  <blockquote>
    <p>Friend Classes are seldom used. They are supported to allow certain special case situations to be handled.</p>
  </blockquote>
  
  <p>And frankly, I have never seen a friend class in any good code made by an experienced C++ programmer. So , here is my list of problems. </p>
  
  <ol>
  <li><p>Do Inherited Classes have the same <strong>friends</strong> as there base classes? e.g, if I declare class foo as a friend of class base, will class <code>der</code> (derived from base) also have foo as a friend?</p></li>
  <li><p>What are the <em>special case situations</em> when a friend class should be used?</p></li>
  <li><p>I am making a winapi wrapper in which I want to make class WinHandle a friend of class Widget (to access some protected members). Is it recommended? Or should I just access them using the traditional Get/Set functions?</p></li>
  </ol>