This is undefined behaviour. Whether it "works" or not on any given compiler is probably besides the point; you cannot rely on this working in general.*
In the scenario you've described, it sounds like the best solution is just to create some free functions that take a Base
as an argument. Of course, if the required functionality relies on protected
members, then you have a problem! (And I'm not sure there's a good solution, other than to find a way to avoid needing such access.)
* And that's true even if you never change your compiler. The compiler is free to assume that all code is "correct", so a slight change to your code may trigger an optimization that renders the above trick useless.
(Of course, I'm not going to to suggest that this will definitely happen, merely that it could.)