Using variadic templates to specify friend classes
I'm trying to use variadic templates to specify friend classes. I try with the following syntax, but it doesn't work. template <class... Args> struct A { friend Args...; }; I try to code some workarounds, but it seems to be not so simple since the friendship is not transitive and inherited. So the question is if there is a correct syntax or any workaround to make each individual class in Args be a friend of A? Maybe the following CRTP variant would be sufficient for your use: template<typename Arg> class Abase { friend Arg; virtual int foo(int) = 0; // this is the private interface you want to