first implementation using template inheritance