Why do C++ Classes Fold According to Indent as Opposed to Closing Brace?

When I declare a class in C++, I expect the folding icon at the beginning of the class to fold the entire class, rather than only the private members. Look at the simple example below

class Box { // This is where the folding starts

double length, width, height; // This is where the folding is ending

Box(double, double, double); // Elementwise constructor

Box(const Box &); // Copy constructor

double volume() const; // Return the volume
}; // This is where the folding should end

I am using the ide-cpp and linter-gcc2 packages which are formatting my code automatically like the above upon saving. But after some tweaking, I realised there are two factors contributing to the behaviour.

  • My linter sets the public access specifier without any indent, and setting a public method declaration with two indents. (I thought the standard practice is to indent with two spaces for the public, and four spaces for each public method)

  • Atom folds by indentations (as if C++ is Python) rather than by curly brackets as it should

So I wonder, is it a problem with my style (so that I have to indent the keyword public)? Or is it a problem with Atom’s behaviour? How to correct in either case? Any linter package that will set the correct style?

Note that I can fold all the public methods separately, but then it means every class will have one line for the class declaration, another line for the public keyword, contributing to visual clutter. Here is a screenshot which I hope helps to demonstrate the situation.