Is there any way to make a typedef friend of a class?

229 Views Asked by At

... In my case:

    template<class X>
    struct _Command {
        char*   id;
        char*   description;
        char    messages[10][100];
        bool    (X::*function)();
    };

    Class Server {
        public:
            typedef _Command<Server>Command;
    }

How do I make Command friend of the Server class?

1

There are 1 best solutions below

0
On BEST ANSWER

You can use the typedef normally in the friend declaration:

class Server {
public:
    typedef _Command<Server> Command;
    friend Command;
};