Why does a magnetic compass needle pointing North and South in the absence of a nearby magnet get deflected when a bar magnet or a current carrying loop is brought near it?
Current-carrying loops behave like bar magnets and both have their associated field lines. This modifies the already existing earth'* magnetic field and a deflection results.