Create class before index

If trying to define an index on a class that does not yet exist, create the class first, also specifying the correct ancestor.