convert Stack class to Stack class template