When William Congreve wrote his libretto -LRB- for another composer -RRB- early in the 18th century , references to the conflict between the royal houses of Hanover and Stuart in England were not hard to see .