Implement a stack using template