What happens to the needle of a compass if you place the compass near a current carrying wire?
It gets deflected.
Moving charges produce magnetic fields which are proportional to the current and hence, a current carrying conductor produces magnetic effect around it. A current carrying wire behaves like a magnet and affects other magnets in its magnetic field. As a result, the needle of the compass gets deflected when we place a compass near a current conducting wire.