The base class must be a template with one parameter being the derived class:
template <typename D>
class Base {
...
};
and then: class Derived: public Base<Derived> {
...
};
This is called the https://en.wikipedia.org/wiki/Curiously_recurring_template_p...