class to trait