That’s a spittlebug 🙂
Never heard of spittlebugs? Me too. I found info. The foam on plant surfaces is often the result of a spittlebug infestation. Immature spittlebugs are hidden inside white frothy foam as they feed on the plant tissue. Other than looking unsightly, spittlebugs do very little damage to a plant. Most healthy plants can handle a spittlebug infestation with no serious damage.
Remove flower parts with foam and wash/spray infested flower with liquid made with 1 cup water and 1 teaspoons liquid soap (dishwasher detergent).