Imagine we have this code:
template <class, class>
class Element
{};
template <class T>
class Util
{
public:
template <class U>
using BeFriend = Element<T, U>;
};
Is it possible to mark BeFriend
as a friend ? (Of Util
, or any other class).
Edit
The "obvious" syntax were tried, but both failed with Clang 3.6.
template <class> friend class BeFriend;
template <class> friend BeFriend;
I did not know about the second syntax, but found it in this answer. It seems to work (and be required) for non-template aliases, but does not help in this case where the alias is templated.
(Note: as some could infer from the minimal example, I am looking for a way to work-around the limitation that C++ does not allow to friend a partial template specialization)
template <class> friend class BeFriend
andtemplate <class> friend BeFriend
with no success on Clang 3.6, so a little more details would go a long way here :) – ValdemarElement
is defined - it would involve nested class templates. Not sure if it would help you. It looks like this. – Samanthasamanthia