What is an analogy?

A comparison of two things based on their structure
A comparison of two things using the word like
An explanation of how two things work
An explanation of two literary devices