To return a reference in the way that you do in the example is a very good example of "how you can expose a private member by returning a reference". This is obviously a design decision that you can make if you want to - and you could change x by name or even how it's stored (you could store it inside a struct, or as a pointer for example) without changing the interface.
But as Laserlight says, it's not recommended to do so.
--
Mats