implemented State class
using protected instead of friend
implemented dot method