This looks like a case of the missing reactant. I don't think you can quaternize pyrrole like that. Okay for an N-alkylation. Heating B makes more sense if a dienophile were present. Then reacting with KOH with its functionality would seem more plausible. I'm just guessing though.