Let's say I have some template class which needs an access to private fields of any its specialization:
template<std::size_t SIZE> class Buffer {
template<std::size_t N> friend class Buffer<N>;
...
};
This code doesn't compile:
<source>:4:42: error: specialization of 'template<long unsigned int SIZE> class Buffer' must appear at namespace scope
4 | template<std::size_t N> friend class Buffer<N>;
| ^~~~~~~~~
How can I achieve this behavior?