In The C++ Programming Language'The C++ Programming Language' the author Bjarne Stroustrup writes:
The protection of private data relies on restriction of the use of the class member names. It can therefore be circumvented by address manipulation and explicit type conversion. But this, of course, is cheating, C++ protects against accident rather than deliberate circumvention (fraud). Only hardware can offer perfect protection against malicious use of a general-purpose language, and even that is hard to do in realistic systems.
It can be said that manipulation is legal but it is a bad practice to preform such manipulations on private member variables.