Class B uses a use a template, which is a private member of class A.
I tried friend declaration but the template is still private within the context.
How to allow B to use a private template of A?
Test (also at godbolt.org):
#include <iostream>
#include <vector>
template <class T>
class A {
private:
template<typename R> using V = std::vector<R>;
};
template <typename T, class Prev>
class B {
public:
friend Prev;
typename Prev::template V<T> v_;
};
int main() {
B<int, A<int>> b;
return 0;
}
Compilation Error:
error: ‘template<class R> using V
= std::vector<R, std::allocator<_CharT> >’
is private within this context
typename Prev::template V<T> v_;
^~