Professor McGonagall is a character from J.K. Rowling's "Harry Potter" series of books and films, and is also referenced by The Sorting Hat in the upcoming Scary Godmother x Harry Potter crossover.
History with The Sorting Hat
Although it is debatably non-canon, it can be assumed that at some point, McGonagall was having a secret affair with The Sorting Hat. After stumbling onto an on-going affair between the hat and Professor Severus Snape, McGonagall vowed not to blab about the matter. However, the relationship had tapered off soon after her discovery. As such, she decided to throw her own hat in and give it a try with The Sorting Hat herself.
As fate would have it, Snape ultimately caught on and exposed the two secret lovers. Relations with McGonagall and The Hat have been shaky ever since.