Fix inheritance relations.

Use the same relations as in the C++ library.