Mangle the names of internal classes so they're less likely to conflict with derived class names and members. Fixes #4453.