
"Martin Bonner" wrote:
The problem is the code: template <typename T1, typename T2> class sealed_impl { friend typename T1; friend typename T2; ...
7.1.5.3 p2 says "[Note: this implies that, within a class template with a template type-parameter T, the declaration friend class T; is ill-formed.]"
In other words, you can't do that :-(
While this and similar tricks are forbidden by Standard almost all current compilers are so "buggy" to support the feature. Comeau has even special switch to enable the feature. See article http://www.cuj.com/documents/s=8943/cujexp0312wilson2/ from Mathew Wilson for overview of these techniques. Generally, if something useful can be done because of widely present "bug" it is worth to consider. Boost.Typeof uses VC6 bug to implement otherwise impossible typeof there. /Pavel