Cpp generator: classes have to be sorted by inheritance