A versatile, cerebral and witty composer and lyricist, Mr. Friedman had a particular fascination with politics, which informed much of his work.