Adds support for classes defined in objects, fixes #187