When the current is switched on through a wire, a compass needle kept nearby gets deflected from its north-south position. Explain

When the current is switched on through a wire, a compass needle kept nearby gets deflected from its north-south position. Explain.
Answer:
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.