A metaphor is a figure of speech in which a word or phrase is applied to an object or action, to which it is not applicable.
In simple words, a metaphor is a figure of speech that makes an implicit, implied, or hidden comparison between two things that are unrelated, but which share some common characteristics
1. Jack was fishing for compliments.
In the real sense, Jack cannot be casting a lure to catch compliments from a river! It just means he was looking for compliments.
2. John was so hungry that he could eat a horse.
In the real sense, it means he was extremely hungry and he could eat a lot of food, but not a whole horse!
3. The sun is a golden ball.
In the real sense, one cannot throw and play with the golden ball that the sun is!
Metaphors are used to dramatize thoughts to emphasize and elevate the expression to a higher intensity. Unlike similes, it does not use any words "as" or "like" to bring about the comparison. It compares by saying  X is Y, rather than saying X is like Y or X is as Y as Z.
How to identify whether a statement is a simile or metaphor? Check for words "as" or "like" - if it is present, it is a simile. If not, it is a metaphor.
In the above example, the meaning to be conveyed is the sun is looking like a golden ball.
In simile terms, it will be "The sun is like a golden ball"
In metaphoric terms, it is "The sun is a golden ball"
Metaphors are interesting because it is indirect and keeps the reader guessing to find why the comparison was made. Literal meanings are ignored and metaphoric meanings are used to give depth and drama to the thoughts that are expressed.