It is not the breast feeding so much that protects against cancer; it is the completion of the pregnancy itself.
Breast cancer originates in immature undifferetiated breast cells - tissues that have not matured and specialized yet. These cells proliferate in the first trimester of pregnancy, stimulated by the increase in estrogen that occurs. These young growing cells are especially vulnerable to malgnancy, but the second half of pregnancy takes care of this:
In the second half of pregnancy the estrogen levels recede and the immature cells now differentiate into mature milk-producing tissue in response to the lowered estrogen. These more stable mature cells do not have the tendency toward malignancy.
Even if the woman does not breastfeed, the breast cells have specialized and matured and are less likely to turn cancerous.
I hope this helps - I got the info off a website pregnantpause.org
Lifesitenews also covers this topic
sorry - meant undifferentiated and malignancy - I thought I had proofread but missed a couple
What you write suggests to me that I’m pretty well doomed, because I had several miscarriages. Yes, we did eventually have two children, both of whom were breast-fed, but it didn’t happen ‘til I was over thirty.