The problem is that the snake does not know the map area.
One way to fix it is to pass a pointer of type map to the snake
or probably better
give the snake a x and y position position only;
I also would create a Game class that has the map, snake, score classes.