A ship's compass on a sailboat is often mounted in a binnacle in the cockpit just in front of the wheel. The magnetic part of the compass, including the compass card, floats in oil inside a transparent sphere of glass or plastic so it stays level regardless of how much the boat is heeled.
The compass, of course, gives the boat's heading relative to magnetic north. The compass can also be used to determine bearing to another object by lining up your eye with the object and the center indicator of the compass. A hand bearing compass, however, is usually more accurate for this task.