adds allocate method to Class