When a current is switched on through a wire, the wire starts behaving as a magnet. Hence, when a compass needle is placed near the given current carrying wire, it gets influenced by the magnetic effect of electric current and gets deflected from its North- South position.