Accent and ego
According to a study at the University of Haifa, the strength of your accent when speaking a foreign language depends, to some extent, on how much you like and respect the person you’re talking to. Your position in relation to the other language also affects your accent, something the article calls ‘language ego’.
I’ve noticed that people who identify strongly with a particular region or country are more likely to have a strong regional or national accent. Whereas people who don’t have such strong affiliations are more likely to tone down or switch off their accent and perhaps adopt another, or least aspects of another accent, to make it easier for others to understand them. This does depend on the circumstances though – in some cases people who wouldn’t normally emphasise their accent might do so to show group solidarity, or to signal their opposition to another group.
My accent in English sort of defaults to RP, but takes on a flavours from other accents depending on who I’m talking to. Though I come from Lancashire originally, I’ve never had a strong Lancashire accent and don’t strongly identify with that area. In Welsh I have a mid-Wales accent which is gradually becoming more northern. In Irish I have a strong Ulster accent, which I tone down somewhat when talking to Irish speakers from other regions. In Mandarin I have a Taiwanese accent, though I can do a sort of Beijing one as well, and in French I had a bit of a Languedoc accent which has morphed into something else now. These accents are a result of spending time in the regions where they’re used, so you could say that I identify to some extent with all them.