title: Can I access private members from outside the class without using friends?
body: <h3>Disclaimer</h3>
  <p>Yes, I am fully aware that what I am asking about is totally stupid and that anyone who would wish to try such a thing in production code should be fired and/or shot.  I'm mainly looking to see if <em>can</em> be done.</p>
  <p>Now that that's out of the way, is there any way to access private class members in C++ from outside the class?  For example, is there any way to do this with pointer offsets?</p>
  <p>(Naive and otherwise non-production-ready techniques welcome)</p>
  <h3>Update</h3>
  <p>As noted in the comments, I asked this question because I wanted to write a blog post on over-encapsulation (and how it affects TDD).  I wanted to see if there was a way to say &quot;using private variables isn't a 100% reliable way to enforce encapsulation, even in C++.&quot;  At the end, I decided to focus more on how to solve the problem rather than why it's a problem, so I didn't feature some of the stuff brought up here as prominently as I had planned, but I still left a link.</p>
  <p>At any rate, if anyone's interested in how it came out, here it is:  <a href="http://jasonmbaker.wordpress.com/2009/01/08/enemies-of-test-driven-development-part-i-encapsulation/" rel="noreferrer">Enemies of Test Driven Development part I: encapsulation</a> (I suggest reading it before you decide that I'm crazy).</p>