Let me guess, you're trying to declare partial specialisations as friends. A weakness in the current standard is you can't do that.
The closest you can come to is something like this;
Code:
template <class A, class B, class C> class mad_shared_ptr
{
// your other stuff
private:
template<class Alpha, class Bravo, class Charlie> friend class X;
};
The down side of this is that it means all instantiations of the template class X are friends of each other - there is no narrowing down to a subset of possible instantatiations of the template as friends.
For example, you can't replace the friend declaration above with
Code:
template<class Alpha, class Bravo> friend class X<Alpha, Bravo, C>;