You can give the most-derived class as the template parameter to the CRTP base class, so that it will have access to all its members. Instead of
template<typename DERIVED>
class Derived1 : public BASE<Derived1<DERIVED> >
Use:
template<typename DERIVED>
class Derived1 : public BASE<DERIVED>
There are also other issues with your code. For example, you can't directly call self()
like you do because the compiler doesn't know that self
is a member of the base class (which is dependent on a template parameter). Instead, call this->self()
. See this FAQ entry.