Dakota Johnson is set to star in the new comedy 'The Friend'.

Dakota Johnson

Dakota Johnson

The 29-year-old actress will star alongside Jason Segal and Casey Affleck in the upcoming independent flick, directed by Gabriela Cowperthwaite and production will start next month in Fairhope, Alabama.

The film will follow the extraordinary real-life story of Nicole and Matthew Teague.

Played by Dakota and 43-year-old Casey whose best friend Brad Ingelsby, portrayed by Jason, 39, decided to put his life on hold and move into the couple's house after discovering Nicole had six months to live.

Kevin Walsh, Michael Pruss and Ryan Stowell will produce for Ridley Scott's Scott Free banner with Teddy Schwarzman for Black Bear Pictures, who are set to finance the entire project, while Scott himself will serve as an executive producer and Ben Stillman and Michael Heimler will serve as executive producers alongside Ingelsby, Teague, Scott and Ted Deiker.

In a statement, Matthew said: "I'm thrilled and honored to see the story come to life this way, thanks to the filmmaking vision of Gabriela Cowperthwaite and a script that Brad Ingelsby and I worked on closely together. It captures what's at the heart of the story: deep love and loss, and the saving grace of friendship, to have the talents of Dakota Johnson, Jason Segel and Casey Affleck help the story live on is remarkable.

"And I'm grateful to Scott Free and Black Bear, who have been both passionate and sensitive from day one. I hope the story gives people an honest glimpse of what it means to face mortality, and the value of having a true friend at your side, when that moment comes."