Here is the answer:
obj2 in class someClass is a type of Inner * const, which means that the pointer is const, not the data itself, thus it is calling a non const function.
To get the expected output, the obj2 must be declared in this way:
Inner const * obj2;