Fix #18062 where with build make the inheritance object instead of parent object