title: When to use friend class in C++
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 was brushing up on my C++ (I'm a Java developer) and I came across the <code>friend class</code> keyword which I had forgotten about for a while. Is this one of those features that's just part of the kitchen sink, or is there a good reason for doing this rather than just a vanilla getter? I understand the difference in that it limits who can access the data, but I can't think of a scenario when this would be necessary.</p>
  
  <p>Note: I've seen a similar question, but specifically I'm asking, is this just an advanced feature that adds no real value except to confuse people looking at you're code until they realize what you're doing?</p>