@lesley yes, but in the case of @riley that's not the same issue: if foo has-a bar, there's no way to do the casting _implicitly_, as far as a I know. It would be possible with references by defining an implicit constructor of bar from foo, but this won't be applied to pointers.
The only work around I can think of is to define an overloaded function
bar * get_bar(bar * o) { return o; }
bar * get_bar(foo * o) { return &o->bar_element; }
and wrap pointer arguments with that function.