Declaring a class that works with a constrained generic type