An elephant has taken a man's hat in its trunk.