A simile is a metaphor that uses the word "like" or "as" to directly compare two things or concepts. In this case, the attraction between the people, due to the fact that they were very different, was comparable to the attraction between opposite poles of a magnet.