The former Malcolm in the Middle star will guest as a friend from Patricia Heaton's character's teaching days.