How is a coil of current carrying wire similar to a bar magnet