// The base class template<class Crtp, class MsgT> class Receiver { void receive(MsgT) { static_cast<Crtp*>(this)->private_ += 1; } }; // The derived class template<class... MsgTs> // notice the variadic template parameters struct Dispatcher : public Receiver<Dispatcher<MsgTs...>, MsgTs>... // Inheritance supports pack expansion { using Receiver<Dispatcher, MsgTs>::Receiver...; // The using directive support pack expansion friend Receiver<Dispatcher, MsgTs>...; // Error pre-C++26, accepted from C++26 private: int private_; };