I have been working on a custom CMS and I would like to work with that when if have e.g. a customer. But I asked some friends of mine what I should do: just use a already existing CMS like Joomla or Wordpress, or write my own.
The reason I want to use a custom CMS is because I learn to script more fast and I have full control over everything and I know exactly what's happening.
Developing a custom solution feels always fast, because you are actively writing code yourself.
On the other hand, when using Joomla or Wordpress, you need to learn existing system and you spend more time on the learning side of the things.
If the CMS is not specialized (video, government documents, etc.) it rarely pays off to write custom stuff: in the end you need to write much more code, though that development might feel to have fast pace. PHP CMSes are well productized and the benefits of picking one outweight the benefits of maintaining large codebase written by a single person (you). With open source CMS you can draw resources on much larger pool.
Also it is your customer benefit to base the codebase on well-known product for the cases where you might not be available. It would not be honest business if you leave out telling the benefits of open source for your customer.
There are tons of well known/well thought of CMSs out there and clients learned to love and use them.
Writing your own CMS is no easy task (and that is an understatement).
If it is just for learning purposes then by all means, go and write your own, but for a client project, I'd suggest you use one of the existing ones.
As for flexibility, most CMSs today allow almost maximum flexibility; there is almost nothing you can't do with them.
I'd go for learning how to extend an already existing CMS.
There are several reasons to do so:
Drupal, Wordpress and Joomla all have great communities, so you will almost surely get:
Most of the features that your client will require are probably already implemented by those mature CMSes
It is a known fact that it is easier to create your own piece of code than to try to understand someone else's code. This might be the only reason you should start to create your own.
Although try to imagine how many mistakes were done and corrected regarding architecture, design and patterns in more than 10 years of coding on those mature CMSes by the hundreds of people working on them. Are you ready to repeat and correct them?
As suggested in your comments, if you want to do this for a learning experience, sure, go ahead! It will be a huge learning experience. You must not give up and keep working on improving it constantly.
However, even if you spend the next 6 months working on your CMS alone, it might not have the same power and polish as Drupal or any other CMS. You might be disadvantaging the client.
But who knows, if you were to bring a radical new paradigm of thinking about content, you might just gather a giant community and then your CMS becomes a viable alternative to hundreds already out there.
Don't get into this without a serious amount of research and planning.