To the OP: if you were to _want_ the cast to work on other compilers,
you can use a C cast when initializing your Test class with the
dynamically allocated Derived type. It is pretty bad form (it breaks
the intended encapsulation), but it is valid.
It is an interesting thing that traversing a private inheritance graph
with the correct pointer offsetting (that is, as if by a static_cast) is
one of the few things that can only be done in C++ with a C cast, and
cannot be done with a static_cast (inaccessible base) nor
reinterpret_cast (undefined behavior except with standard layout
types) - see §5.4/4 of C++14 in describing the behaviour of C casts:
"The same semantic restrictions and behaviors apply, with the exception
that in performing a static_cast in the following situations the
conversion is valid even if the base class is inaccessible: ...".
Chris