A foliage of folly
Can we circumvent the private access rules without relying on techniques that are considered “arcane” and likely to be made illegal (at some point)?
I recently read the article Profiting from the Folly of Others by Alastair Harrison, which walks through a technique to circumvent private access rules, particularly by means of (ab)using the template instantiation mechanism together with injections of inline friend definitions. I first saw this technique used in Filip Roséen’s blog article series on stateful metaprogramming back in 2015, which made use of it to implement a constexpr-counter that were, if not fully, at the very least nearly1 standard compliant. A. Harrison’s article mentions that the origin of the technique is likely two blog articles by Johannes Schaub published in 2010-20112.