Fix the default scope of classes

The default class scope was incorrectly set as `namespace`.
3.5 has the same typo and this should be backported.